package cn.gzjp.modules.dt.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

/**
 * 考试Entity
 * @author zengcp
 * @version 2018-02-24
 */
public class Exam extends DataEntity<Exam> {
	
	private static final long serialVersionUID = 1L;
	private String openid;		// openid
	private Question question;		// 题目
	private String answer;		// 正确答案
	private String result;		// 0答对1答错
	private Integer sn;		// 序号
	private Date createTime;		// 创建时间
	private Date answerTime;		// 答题时间
	
	public Exam() {
		super();
	}

	public Exam(String id){
		super(id);
	}

	@Length(min=0, max=32, message="openid长度必须介于 0 和 32 之间")
	@ExcelField(title="openid", align=2, sort=1)
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	@JsonIgnore
	public Question getQuestion() {
		return question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

	@Length(min=0, max=2, message="正确答案长度必须介于 0 和 2 之间")
	@ExcelField(title="正确答案", align=2, sort=3)
	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}
	
	@ExcelField(title="0答对1答错", align=2, sort=4)
	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public Integer getSn() {
		return sn;
	}

	public void setSn(Integer sn) {
		this.sn = sn;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="创建时间", align=2, sort=6)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="答题时间", align=2, sort=7)
	public Date getAnswerTime() {
		return answerTime;
	}

	public void setAnswerTime(Date answerTime) {
		this.answerTime = answerTime;
	}
	
}